<template>
	<view class="p-l-30 p-r-30">
		<uni-nav-bar statusBar fixed backgroundColor='#3f6efe' color='#fff'>
			<view class="w-100p flex-c flex-aic f-28">个人中心</view>
		</uni-nav-bar>
		
		<navigator url="userdetail/userdetail" hover-class="none">
			<view class="bgc-white br-12 m-t-40  p-t-30 bs-b p-b-30 p-l-28 p-r-30 flex flex-aic" hover-class="active">
				<image mode="widthFix" class="user_avatar w-100 h-100 br-50p bgc-blue" :src="userinfo.avatar?userinfo.avatar:'../../static/images/defult.jpg'"></image>
				<view class="p-l-30 flex-1">
					<view class="f-35 fw-small">{{userinfo.username}}</view>
					<view class="f-20 c-33">共报账{{userinfo.count}}次</view>
				</view>
				<uni-icons type="forward" size="20" color='#cecece'></uni-icons>
			</view>
		</navigator>


		<view class="bgc-white br-12  bs-b m-t-20 ">
			<uni-link :showUnderLine='false' color='#333333' href="https://gitee.com/yanjianhang/bill.git">
				<view  class="p-15 flex h-80 flex-aic b-b p-l-25" hover-class="active">
					<view class="flex-1">关于</view>
					<uni-icons type="forward" size="20" class='m-r-15' color='#cecece'></uni-icons>
				</view>
			</uni-link>

			<navigator url="password/password" hover-class="none">
				<view class="p-15 flex h-80 flex-aic p-l-25" hover-class="active">
					<view class="flex-1">重置密码</view>
					<uni-icons type="forward" size="20" class='m-r-15' color='#cecece'></uni-icons>
				</view>
			</navigator>
		</view>
		
		<!-- 管理员权限 -->
		<view class="bgc-white br-12  bs-b m-t-20 " v-if="userinfo.level===1">
			
			<navigator url="audit/audit" hover-class="none">
				<view class="p-15 flex h-80 flex-aic b-b p-l-25" hover-class="active">
					<view class="flex-1">报销审核</view>
					<uni-icons type="forward" size="20" class='m-r-15' color='#cecece'></uni-icons>
				</view>
			</navigator>
			
			<navigator url="user-list/user-list" hover-class="none">
				<view class="p-15 flex h-80 flex-aic b-b p-l-25" hover-class="active">
					<view class="flex-1">用户管理</view>
					<uni-icons type="forward" size="20" class='m-r-15' color='#cecece'></uni-icons>
				</view>
			</navigator>
		
			<navigator url="type/type" hover-class="none">
				<view class="p-15 flex h-80 flex-aic p-l-25" hover-class="active">
					<view class="flex-1">管理报销类型</view>
					<uni-icons type="forward" size="20" class='m-r-15' color='#cecece'></uni-icons>
				</view>
			</navigator>
		</view>
		
		<view class="p-l-20 p-r-20">
			<button class="btn-medium w-100p m-t-50  br-18" type="warn" @click="outLogin">退出登录</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
			   userinfo:{
				   
			   }
			}
		},
		onShow() {
			this.$http.get('/user/userinfo').then(res=>{
				this.userinfo = res.data
			})
		},
		methods:{
			outLogin(){
				uni.setStorageSync('token',"")
				uni.reLaunch({
					url:'/pages/login/login'
				})
				 
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.b-show {
		box-shadow: 0 0 10upx 1upx rgba(66, 56, 46, .1);
	}
	.active {
		opacity: .4;
	}
</style>
